<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="./lib/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="./lib/bootstrap-validator/css/bootstrapValidator.min.css">
    <link rel="stylesheet" href="./lib/nprogress/nprogress.css">
    <link rel="stylesheet" href="./css/commom.css">
    <title>首页</title>
</head>

<body >
    <!-- 侧边栏 -->
    <div class="lt-aside body-bg">
        <!-- login -->
        <a href="#" class="brand">黑马34期 666</a>
        <!-- 用户信息 -->
        <div class="user">
            <img src="./images/dog.jpg" alt="">
            <p>超级管理员</p>
        </div>
        <!-- 导航 -->
        <ul class="lt-nav">
            <li><a href="user.html"><span class="glyphicon glyphicon-user"></span>  用户管理</a></li>
            <li>
                <a href="#" class="category"> 
                    <span class="glyphicon glyphicon-list "></span> 分类管理
                </a>
                <!-- 二级导航 -->
                <div class="child" style="display: block">
                    <a href="first.html" >一级菜单</a>
                    <a href="second.html">二级菜单</a>
                </div>
            </li>
            <li><a   class="current" href="product.html"> <span class="glyphicon glyphicon-tags"></span> 商品管理</a></li>
        </ul>
    </div>
    <!-- 主体 -->
    <div class="lt-main">
        <div class="topbar">
            <a href="#" class="pull-left top-menu">
                <span class="glyphicon glyphicon-align-justify"></span>
            </a>
            <a href="#" class="pull-right top-logout">
                <span class="glyphicon glyphicon-log-out"></span>
            </a>
        </div>
       <div class="container">
           <!-- 路径导航 -->
           <ol class="breadcrumb mt-20">
                <li><a href="#">管理系统</a></li>              
                <li class="active">产品管理</li>
            </ol>
            <!-- 添加商品-->
            <button class="btn btn-default" data-toggle="modal" data-target="#addModal">添加商品</button>
            <!-- 表格 -->
            <table class="table table-bordered table-hover mt-20">
                <thead>      
                       						               		
                    <tr>
                        <th>序号</th>
                        <th>商品名称</th>
                        <th>商品描述</th>
                        <th>商品库存</th>
                        <th>商品尺寸</th>
                        <th>商品状态</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>1</td>
                        <td>名称</td>
                        <td>描述</td>
                        <td>库存</td>
                        <td>尺寸</td>
                        <td>状态</td>
                        <td>
                            <button class="btn btn-danger">下架</button>
                        </td>
                    </tr>
                </tbody>

            </table>
            <!-- 分页父容器 -->
            <div class="pull-right">
                <ul id="paginator"></ul>
            </div>
       </div>
    </div>

    <!-- 添加分类 -->
    <!-- modal-sm 小模态框  modal-lg 大模态框  -->
     <!--  data-dismiss="modal"  自定义可以隐藏模态框  -->
     <div class="modal fade userModal" id="addModal" tabindex="-1" role="dialog">
            <div class="modal-dialog " role="document">
              <div class="modal-content">              
                <div class="modal-header">
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                  <h4 class="modal-title">添加商品</h4>
                </div>
                <div class="modal-body">
                    <form id="form">

                        <!-- 一级分类下拉 -->
                        <div class="form-group">                        
                                <div class="dropdown">
                                    <button id="dLabel" type="button" data-toggle="dropdown" class="btn btn-default" >
                                        <span class="cate-text">请选择二级分类</span>
                                        <span class="caret"></span>
                                    </button>
                                    <ul class="dropdown-menu cate-list" >
                                        <li><a href="#">xx馆</a></li>                     
                                    </ul>
                                </div>
                                <input type="hidden" name="brandId" class="brandId">
                               
                        </div>
                        <!-- 商品名称 -->
                        <div class="form-group">
                            <input type="text" name="proName" class="form-control" placeholder="请输入商品名称">
                        </div>
                        <!-- 商品描述 -->
                        <div class="form-group">                           
                            <textarea name="proDesc"  cols="30" rows="3" class="form-control" placeholder="请输入商品描述"></textarea>
                        </div>
                        <!-- 商品库存 -->
                        <div class="form-group">
                            <input type="text" name="num" class="form-control" placeholder="请输入商品库存">
                        </div>
                        <!-- 商品尺寸 -->
                        <div class="form-group">
                            <input type="text" name="size" class="form-control" placeholder="请输入商品尺寸">
                        </div>
                        <!-- 商品原价 -->
                        <div class="form-group">
                            <input type="text" name="oldPrice" class="form-control" placeholder="请输入商品原价">
                        </div>
                        <!-- 商品现价 -->
                        <div class="form-group">
                            <input type="text" name="price" class="form-control" placeholder="请输入商品现价">
                        </div>

                        <!-- 分类logo -->
                        <div class="form-group">
                            <label for="file" class="btn btn-default">上传图片</label>
                            <!-- 
                                当文件域选中文件后，会立即上传，要先通过data-url指定上传的地址
                                mutiple 用于多文件上传
                                data-url 指定服务器提交图片地址
                             -->
                            <input type="file" name="pic1" id="file" data-url="/product/addProductPic" style="display: none" multiple >
                        </div>
                        <div class="form-group img-list">  
                                              
                            <!-- 如果图片等于3张 验证通过，否则验证失败 -->
                            <input type="hidden" name="brandLogo" class="hide-logo">
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                  <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                  <!--通过form属性 = 表单域id  可以指定 表单属于哪个form  -->
                  <button type="submit" class="btn btn-primary btn-ok" form="form">确定</button>
                </div>               
              </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
          </div><!-- /.modal -->

    <script type="text/html" id="tmp">
        {{ each rows v i }}
            <tr>
                <td>{{ i + 1 + (page-1) * size }}</td>
                <td>{{ v.proName}}</td>
                <td>{{ v.proDesc}}</td>
                <td>{{ v.num}}</td>
                <td>{{ v.size }}</td>
                <td>{{ v.statu == 1? '正常': '下架' }}</td>
                <td>
                    {{ if v.statu ==1  }}
                        <button class="btn btn-danger">下架</button>
                    {{ else }}
                        <button class="btn btn-success">上架</button>
                    {{/if }}
                </td>
            </tr>
        {{ /each }}
    </script>
          

    <script type="text/html" id="tmp-cate">
        {{ each rows v i }}
            <li><a href="#" data-id={{ v.id }}>{{ v.brandName }}</a></li>
        {{ /each }}
    </script>



    <script src="./lib/jquery/jquery.min.js"></script>
    <script src="./lib/bootstrap/js/bootstrap.min.js"></script>
    <script src="./lib/bootstrap-validator/js/bootstrapValidator.min.js"></script>
    <script src="./lib/nprogress/nprogress.js"></script>
    <script src="./lib/artTemplate/template-web.js"></script>
    <script src="./lib/bootstrap-paginator/bootstrap-paginator.min.js"></script>
    <script src="./lib/jquery-fileupload/jquery.ui.widget.js"></script>
    <script src="./lib/jquery-fileupload/jquery.fileupload.js"></script>
    <script src="./js/isLogin.js"></script>
    <script src="./js/common.js"></script>
    <script src="./js/product.js"></script>

</body>

</html>